package com.example.keli.ui.reward;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.keli.R;
import com.example.keli.base.adapter.RecyclerAdapter;
import com.example.keli.base.adapter.RecyclerViewHolder;
import com.example.keli.base.utils.DataUtil;
import com.example.keli.base.utils.GlideUtil;
import com.example.keli.ui.center.ActiveDetailsActivity;
import com.example.keli.ui.center.ActivieList;

import java.util.List;

/**
 * description $desc$
 * created by jerry on 2019/3/18.
 */
public class RewardAdapter extends BaseQuickAdapter<RewardList.RewardVO, BaseViewHolder> {

    private Context mContext;

    public RewardAdapter(List<RewardList.RewardVO> mData, Context context) {
        super(R.layout.item_reward, mData);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, final RewardList.RewardVO rewardVO) {
        TextView city = helper.getView(R.id.tv_city);
        TextView name = helper.getView(R.id.tv_name);
        TextView date = helper.getView(R.id.tv_time);
        TextView activeDetail = helper.getView(R.id.tv_active_detail);
        ImageView imageView = helper.getView(R.id.iv_reward);

        activeDetail.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ActiveDetailsActivity.start(mContext, rewardVO.getId());
            }
        });

        city.setText("["+rewardVO.getRegion_name()+"站]");
//        Glide.with(mContext).load(rewardVO.getCover_picture()).into(imageView);
        GlideUtil.displayRound(mContext, imageView, rewardVO.getCover_picture(), 5);
        name.setText(rewardVO.getTitle());
        date.setText("起止时间:"+DataUtil.getData(rewardVO.getStart_time())+"-"+DataUtil.getData(rewardVO.getEnd_time()));

    }
}
